
<script setup>
import { ref, onMounted } from 'vue';
import axios from 'axios';
const items = ref([]);
onMounted(async()=>{
  const {data} = await axios.get('http://localhost:8080/api/items');
  items.value = data.data.content || [];
});
</script>
<template>
  <main style="padding:24px">
    <h1>后台管理 · 商品列表</h1>
    <div v-for="i in items" :key="i.id" style="padding:12px;margin:8px;background:#fff;border:1px solid #eee;border-radius:8px;">
      <b>{{i.title}}</b> - ￥{{i.price}} · {{i.category}}
    </div>
  </main>
</template>
<style>body{background:#f6f7f9;font-family:ui-sans-serif,system-ui;}</style>
